#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<string>
using namespace std;
vector<int> mul(vector<int> A, int b)
{
	vector<int> C;
	int t = 0;
	for (int i = 0; i < A.size()||t; i++)
	{
		if (i < A.size())t += A[i] * b;
		C.push_back(t % 10);
		t /= 10;
	}
	return C;//[8,7,6,5,4,3,2,1]
}
int main()
{
	string s;
	int b;
	cin >> s >> b;
	vector<int> A;
	for (int i = s.size() - 1; i >= 0; i--)A.push_back(s[i] - '0'); //[6, 5, 4, 3, 2, 1] 
	auto C = mul(A, b);
	for (int i = C.size() - 1; i >= 0; i--)cout << C[i] << endl;
	return 0;
}